<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2021/7/23
  Time: 11:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> 注册</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico"> <link href="static/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="static/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="static/css/animate.min.css" rel="stylesheet">
    <link href="static/css/style.min.css?v=4.0.0" rel="stylesheet"><base target="_blank">
</head>
<body class="gray-bg">
<div class="middle-box text-center loginscreen   animated fadeInDown">
    <div>
        <div>
            <h1 class="logo-name">ssm</h1>
        </div>
        <h3>欢迎注册 </h3>
        <p>创建一个新账户</p>
        <form class="m-t" role="form" action="register" method="post">
            <div class="form-group">
                <input type="text" class="form-control" placeholder="请输入用户名" name="uname" >
            </div>
            <div class="form-group">
                <input type="text" class="form-control account" placeholder="请输入账号" name="uaccount"><span class="msg"></span>
            </div>
            <div class="form-group">
                <input type="password" class="form-control" placeholder="请输入密码" name="upsw" >
            </div>
            <div class="form-group">
                <input type="text" class="form-control" placeholder="联系电话" name="uphone" >
            </div>
            <div class="form-group text-left">
                <div class="checkbox i-checks">
                    <label class="no-padding">
                        <input type="checkbox"><i></i> 我同意注册协议</label>
                </div>
            </div>
            <button type="submit" class="btn btn-primary block full-width m-b">注 册</button>
            <p class="text-muted text-center"><small>已经有账户了？</small><a href="login.jsp">点此登录</a>
            </p>
        </form>
    </div>
</div>
<script src="static/js/jquery.min.js?v=2.1.4"></script>
<script src="static/js/bootstrap.min.js?v=3.3.5"></script>
<script src="static/js/plugins/iCheck/icheck.min.js"></script>
<script>
    $(function (){
        //判断账号是否存在
        $(".account").blur(function (){
            let account=$(this).val();
            $.ajax({
                url:"findAccount",
                method:"post",
                data:{uaccount:account},
                success:function (data){
                    if (data=="true"){
                        $(".msg").html("恭喜，改账号可用！")
                        $(".msg").css("color","green")
                    }else {
                        $(".msg").html("账号已存在")
                        $(".msg").css("color","red")
                    }
                },
                error:function (){
                    alert("网络异常，请刷新重试")
                }
            })
        })
    })
</script>
</body>
</html>
